<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title>Document</title>
    <style>
        
    </style>
</head>
<body>
    
</body>
<script>

    // test方法的特性：只验证字符串的局部
    // 只要字符串中某个部分符合正则，就是true

    // qq号：
    // var reg = /^[1-9]\d{5,10}$/;
    // console.log( reg.test( "704206198" ) );
    // console.log( reg.test( "0704206198" ) );
    // console.log( reg.test( "070ASFGDH4206198" ) );

    // 手机号：
    // var reg = /^1[3-9]\d{9}$/;
    // console.log( reg.test( "17600901915" ) );
    // console.log( reg.test( "176009019151" ) );
    // console.log( reg.test( "1760090191" ) );
    // console.log( reg.test( "27600901915" ) );
    // console.log( reg.test( "12600901915" ) );


    // 固话
    // var reg = /^(0\d{2,3}-)?\d{7,8}(-\d{1,4})?$/;

    // console.log( reg.test( "0374-1234567-666" ) );
    // console.log( reg.test( "1234567-666" ) );
    // console.log( reg.test( "1234567" ) );
    // console.log( reg.test( "0374-1234567" ) );
    // console.log( reg.test( "021-1234567" ) );
    // console.log( reg.test( "021-12345687" ) );

    // console.log( reg.test( "121-12345687" ) );
    // console.log( reg.test( "123456" ) );
    // console.log( reg.test( "1234567-12345" ) );


    // 网址
    // var reg = /^(https?:\/\/)?(\w{1,10}\.)?\w{2,10}(\.[a-z]{2,4}){1,2}$/;

    // console.log( reg.test( "https://www.baidu.com" ) );
    // console.log( reg.test( "http://www.baidu.com" ) );
    // console.log( reg.test( "www.baidu.com" ) );
    // console.log( reg.test( "baidu.com" ) );
    // console.log( reg.test( "mp3.baidu.com" ) );
    // console.log( reg.test( "mp3.1000phone.com" ) );
    // console.log( reg.test( "mp3.1000phone.com.cn" ) );
    // console.log( reg.test( "1000phone.net" ) );
    // console.log( reg.test( "1000phone.com" ) );
    // console.log( reg.test( "https:///1000phone.com" ) );
    // console.log( reg.test( "https:/1000phone.com" ) );
    // console.log( reg.test( "https://1000p$hone.com" ) );
    // console.log( reg.test( "https://q.com" ) );




</script>
</html>